//
//  ClassifyView.m
//  BiDongComic
//
//  Created by 吴炳毅 on 16/3/14.
//  Copyright © 2016年 BestRiven. All rights reserved.
//

#import "ClassifyView.h"

@implementation ClassifyView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addAllViews];
    }
    return self;
}


- (void) addAllViews {
    self.backgroundColor = [UIColor whiteColor];
    
    // 1.创建UICollectionViewFlowLayout
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    
    // 1.1设置每个Item的大小
    flowLayout.itemSize = CGSizeMake(90, 210);
    
    // 1.2 设置每列最小间距
    flowLayout.minimumInteritemSpacing = 10;
    
    // 1.3设置每行最小间距
    flowLayout.minimumLineSpacing = 10;
    
    // 1.4设置滚动方向
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    

    
    // 1.7 设置item内边距大小
    flowLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    
    
    
    // 2.创建UICollectionView
    self.collectionView_classify = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-44) collectionViewLayout:flowLayout];
    

    [self addSubview:self.collectionView_classify];

    
}
@end
